﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using SYH178Utils;

namespace SYH178DAL
{
    public class Product_SimpleInfo
    {
        public Product_SimpleInfo()
        { }
        #region  BasicMethod


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SYH178Model.Product_SimpleInfo GetModel(int ProductId)
        {
            SqlParameter[] parameters = {
					new SqlParameter("@ProductId", SqlDbType.Int,4)			};
            parameters[0].Value = ProductId;

            SYH178Model.Product_SimpleInfo model = new SYH178Model.Product_SimpleInfo();
            DataSet ds = Common.SqlHelper.ExecuteDataset(Config.SYHConnStr, CommandType.StoredProcedure, "Product_SimpleInfo_GetModel", parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SYH178Model.Product_SimpleInfo DataRowToModel(DataRow row)
        {
            SYH178Model.Product_SimpleInfo model = new SYH178Model.Product_SimpleInfo();
            if (row != null)
            {
                if (row["Id"] != null && row["Id"].ToString() != "")
                {
                    model.Id = int.Parse(row["Id"].ToString());
                }
                if (row["ProductId"] != null && row["ProductId"].ToString() != "")
                {
                    model.ProductId = int.Parse(row["ProductId"].ToString());
                }
                if (row["Introduction"] != null)
                {
                    model.Introduction = row["Introduction"].ToString();
                }
                if (row["Remark"] != null)
                {
                    model.Remark = row["Remark"].ToString();
                }
            }
            return model;
        }

    
        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}
